<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@page import="ESP.VO.Role"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <jsp:include page="../include.jsp" flush="true"/>
    <script type="text/javascript">
		function update(){
			$("#user_note").attr({disabled:false});
			$("#user_sex").attr({disabled:false});
			$("#user_phone").attr({disabled:false});
			$("#user_qq").attr({disabled:false});
			$("#user_email").attr({disabled:false});
		}
		function save(){
			var sex = $("#user_sex").val();
			var note = $("#user_note").val();
			var  phone = $("#user_phone").val();
			var qq = $("#user_qq").val();
			var email = $("#user_email").val();
			if(sex != '男' && sex != '女'){
				alert('性别输入错误');
				$("#user_sex").focus();
				return false;
			}
			if (!(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).exec(email)) {
				alert('邮箱输入错误');
				return false;
			}
			if(!(/^[0-9]{11,11}$/).exec(phone)){
				alert('电话格式输入错误!请输入11位的手机号!');
				return false;
			}
			if(!(/^[0-9]{5,15}$/).exec(qq)){
				alert('QQ格式输入错误!');
				return false;
			}
			$.post('e01!updateE01Head',{
				user_sex:sex,
				user_phone:phone,
				user_qq:qq,
				user_note:note,
				user_email:email,
				user_id:user_id,
				user_role_id:user_role_id
			},function(message){
				show(message.returnMsg);
				if(message.returnFlag == 'Y'){
					$("#user_note").attr({disabled:true});
					$("#user_sex").attr({disabled:true});
					$("#user_phone").attr({disabled:true});
					$("#user_qq").attr({disabled:true});
					$("#user_email").attr({disabled:true});
				}
			});
		}
    	$(function(){
    		if(user_role_id == '1' || user_role_id == '5'){
    			$("#stu_info").remove();
    		}
    		$.post('e01!queryE01Head',{user_id:user_id,user_role_id:user_role_id},function(rows){
    			if(rows.returnFlag == 'N'){
    				alert(rows.returnMsg);
    				return false;
    			}
    			$('#userform').form('clear');
				$('#userform').form('load', rows[0]);
    		});
    	})
    </script>
  </head>
  <body>
  	<div id="stuwindow" class="easyui-window" title="用户中心>>个人信息" style="padding:6px;"
  			data-options="modal:true,maximizable:true,fit:true,maximizable:false,collapsible:false,
  						  minimizable:false,closable:false,closed:false,draggable:false,resizable:false,inline:false
  					">
  		<center>
		<form id="userform" method="post">
		  	<table border="0" cellspacing="0" cellpadding="0">
		  		<tr>
		  			<td bgcolor="" style="width:120px;" align="right">工/学号：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_id" id="USER_ID" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">姓名：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_name" id="USER_NAME" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">角色：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="role_name" id="ROLE_NAME" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">性别：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_sex" id="user_sex" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">录入时间：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_cre_time" id="user_cre_time" disabled="disabled">
		  			</td>
		  		</tr>
		  		<tr id="stu_info">
		  			<td bgcolor="" style="width:120px;" align="right">学院：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="faculty_name" id="faculty_name" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">年级：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="stu_grade" id="stu_grade" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">专业：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="major_name" id="major_name" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">班级：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="stu_class" id="stu_class" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">小组：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="group_name" id="group_name" disabled="disabled">
		  			</td>
		  		</tr>
		  		<tr>
		  			<td bgcolor="" style="width:120px;" align="right">联系电话：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_phone" id="user_phone" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">QQ：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_qq" id="user_qq" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">邮箱：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_email" id="user_email" disabled="disabled">
		  			</td>
		  			<td bgcolor="" style="width:120px;" align="right">备注：</td>
		  			<td bgcolor="" style="width:120px;" align="left">
		  				<input type="text" name="user_note" id="user_note" disabled="disabled">
		  			</td>
		  		</tr>
		  		
		  		<tr>
		  			<td colspan="8"></td>
		  			<td align="right"><a href="javascript:void(0)" onclick="update()" class="easyui-linkbutton" id="btn-cancel" icon="icon-edit" plain='true'>编辑</a></td>
		  			<td align="left"><a href="javascript:void(0)" onclick="save()" class="easyui-linkbutton" icon="icon-save" plain='true'>保存</a></td>
		  		</tr>
		  		
			</table>
		</form>
		</center>
	</div>
  </body>
</html>
